/*
 *  Copyright 2010 Andrew Kroh
 *
 *  Kroh-IO is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Kroh-IO is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
#include "util.h"

#include <stdio.h>
#include <stdarg.h>

static int g_debug_level = DEBUG_OFF;

void print_copyright()
{
    printf("Kroh-IO  Copyright (C) 2010  Andrew Kroh\n");
    printf("This library comes with ABSOLUTELY NO WARRANTY.\n");
    printf("This is free software, and you are welcome to redistribute it\n");
    printf("under the terms and conditions of the GNU General Public License.\n");
}

void set_debug_level(int debug_level)
{
    g_debug_level = debug_level;
}

void debug_print(int debug_level, const char *msg, ...)
{
    if (debug_level <= g_debug_level)
    {
        va_list args;
        va_start(args, msg);
        vprintf(msg, args);
        va_end(args);
        
        fflush(stdout);
    }
}

